package com.gree.scmservice.controller.saas.tenant;

import com.gree.common.entity.ReturnVo;
import com.gree.common.entity.TablePageData;
import com.gree.scmservice.entity.saas.SaasCommodity;
import com.gree.scmservice.entity.saas.vo.SaasCommodityVo;
import com.gree.scmservice.service.saas.SaasCommdityService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;

import javax.servlet.http.HttpServletResponse;

/**
 * 包路径: com.gree.scmservice.controller.saas
 * 项目名: scm-api
 * 创建时间: 2021-07-12 15:52
 * 描述: TODO
 **/
@Api(tags = "SAAS系统商品(租户端)")
@RestController
@RequestMapping("/saas/tenant/commdity")
public class SaasCommdityController {

    @Autowired
    private SaasCommdityService saasCommodityService;

    /**
     * 查询SAAS系统商品列表(租户)
     */
    @GetMapping("/list")
    @ApiOperation(value = "查询SAAS系统商品列表(租户)")
    @ApiImplicitParam(name = "saasCommodity", value = "SAAS系统商品", dataType = "SaasCommodity")
    public ReturnVo<TablePageData<SaasCommodityVo>> list(SaasCommodity saasCommodity)
    {
        TablePageData<SaasCommodity> list = saasCommodityService.findAllPageCommodityOnUser(saasCommodity);
        return ReturnVo.success(list);
    }

    /**
     * 获取SAAS系统商品详细信息(租户)
     */
    @GetMapping(value = "/{groupId}")
    @ApiOperation(value = "获取SAAS系统商品详细信息(租户)")
    @ApiImplicitParam(name = "groupId", value = "商品ID", dataType = "String")
    public ReturnVo getInfo(@PathVariable("groupId") String groupId)
    {
        return ReturnVo.success(saasCommodityService.getByIdCommodity(groupId));
    }

}

